#include "DeclareFile.h"
//#include "variable.h"
//文件操作，包括读取文件内容和写入文件内容,根据flag的值在对应情景调用

void OpeFile() {
    FILE* fp = NULL;
    if (flag == 7) {  // 写入整个数组
        if (fopen_s(&fp, "test01", "w") != 0 || fp == NULL) {
            printf("文件打开失败!\n");
            return;
        }

        fwrite(ranking, sizeof(int), num_ranking, fp);

        fclose(fp);
        fp = NULL;
    }

    if (flag == 1) {  // 读取整个数组
        if (fopen_s(&fp, "test01", "r") != 0 || fp == NULL) {
            printf("文件打开失败!\n");
            return;
        }



        int* s = (int*)malloc(num_ranking * sizeof(int));  // 动态分配内存


        free(s);
        fclose(fp);
        fp = NULL;
    }
}
